package com.wx.chapter14.list_;

import java.io.Serializable;
import java.util.Iterator;
import java.util.LinkedList;

/**
 * @Author : 佩萁
 * Description :
 * @Create : 2023/7/29 - 23:53
 */
public class LinkedListCRUD {
    public static void main(String[] args) {
        LinkedList linkedList = new LinkedList();
        linkedList.add(1);
        linkedList.add(2);
        linkedList.add(3);
        System.out.println(linkedList);
        linkedList.remove();
        System.out.println(linkedList);
        linkedList.set(1, 999);
        System.out.println(linkedList);
        System.out.println(linkedList.get(1));
        Iterator iterator = linkedList.iterator();
        while (iterator.hasNext()) {
            Object obj = iterator.next();
            System.out.println(obj);
        }
        for (Object obj : linkedList) {
            System.out.println(obj);
        }
    }
}